using System;
using Microsoft.Xna.Framework.Input;

namespace Relay
{
	public static class InputHandler
	{
		static KeyboardState currState;
		static KeyboardState lastState;

		public static void Initialize ()
		{
			currState = Keyboard.GetState();
		}

		public static void Update ()
		{
			lastState = currState;

			currState = Keyboard.GetState();
		}

		public static bool KeyPressed(Keys key)
		{
			return lastState.IsKeyUp(key) && currState.IsKeyDown(key);
		}

		public static bool KeyReleased(Keys key)
		{
			return lastState.IsKeyDown(key) && currState.IsKeyUp(key);
		}

		public static bool KeyDown(Keys key)
		{
			return currState.IsKeyDown(key);
		}

		public static bool KeyUp(Keys key)
		{
			return currState.IsKeyUp(key);
		}
	}
}

